package com.waitingresult.demo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.waitingresult.demo.annotation.CheckEnumsByInt;
import com.waitingresult.demo.annotation.LogName;
import com.waitingresult.demo.enums.SexEnums;
import lombok.Data;

import java.util.Date;

@Data
@TableName(value = "`user`")
public class User {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @TableField(value = "`name`")
    @LogName(value = "姓名")
    private String name;

    @TableField(value = "address")
    @LogName(value = "地址")
    private String address;
    @TableField(value = "sex")
    @LogName(value = "性别", modelTypeEnums = SexEnums.class)
    @CheckEnumsByInt(modelTypeEnums = SexEnums.class)
    private Integer sex;
    // 男 old , 女 new
    //String :  user:  从 [男] 修改为 [女]
    //String :  user:  从 [1] 修改为 [2]

    @TableField(value = "is_delete")
    private Boolean isDelete;

    @TableField(value = "create_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @LogName(value = "创建时间")
    private Date createTime;

    @TableField(value = "create_by")
    @LogName(value = "创建人")
    private String createBy;

    @TableField(value = "update_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @LogName(value = "更新时间")
    private Date updateTime;

    @TableField(value = "update_by")
    @LogName(value = "更新人")
    private String updateBy;

}